﻿using APP.HELPER.Data.Helper;
using System; using Extra.ERP;
using System.ComponentModel;
using System.Data.SqlClient;

namespace HRM.CORE
{
    public class HRM_DEPARTMENT_RATE
    {
        private string m_DepartmentCode;
        private string m_GroupRateCode;
        private bool m_IsRate;

        public HRM_DEPARTMENT_RATE()
        {
            this.m_DepartmentCode = "";
            this.m_GroupRateCode = "";
            this.m_IsRate = true;
        }

        public HRM_DEPARTMENT_RATE(string DepartmentCode, string GroupRateCode, bool IsRate)
        {
            this.m_DepartmentCode = DepartmentCode;
            this.m_GroupRateCode = GroupRateCode;
            this.m_IsRate = IsRate;
        }

        public string Get(string DepartmentCode, string GroupRateCode)
        {
            string str = "";
            string[] myParams = new string[] { "@DepartmentCode", "@GroupRateCode" };
            object[] myValues = new object[] { DepartmentCode, GroupRateCode };
            SqlHelper helper = new SqlHelper();
            SqlDataReader reader = helper.ExecuteReader("HRM_DEPARTMENT_RATE_Get", myParams, myValues);
            if (reader != null)
            {
                while (reader.Read())
                {
                    this.m_DepartmentCode = Convert.ToString(reader["DepartmentCode"]);
                    this.m_GroupRateCode = Convert.ToString(reader["GroupRateCode"]);
                    this.m_IsRate = Convert.ToBoolean(reader["IsRate"]);
                    str = "OK";
                }
                reader.Close();
                helper.Close();
                reader = null;
            }
            return str;
        }

        public void SetData(string DepartmentCode, string GroupRateCode, bool IsRate)
        {
            this.m_DepartmentCode = DepartmentCode;
            this.m_GroupRateCode = GroupRateCode;
            this.m_IsRate = IsRate;
        }

        public string Update(string DepartmentCode, string GroupRateCode, bool IsRate)
        {
            string[] myParams = new string[] { "@DepartmentCode", "@GroupRateCode", "@IsRate" };
            object[] myValues = new object[] { DepartmentCode, GroupRateCode, IsRate };
            SqlHelper helper = new SqlHelper();
            return helper.ExecuteNonQuery("HRM_DEPARTMENT_RATE_Update", myParams, myValues);
        }

        public string AssemblyVersion
        {
            get
            {
                return "2.5.0.0";
            }
        }

        public string Copyright
        {
            get
            {
                return "C\x00f4ng Ty Phần Mềm Ho\x00e0n Hảo";
            }
        }

        [Category("Primary Key"), DisplayName("DepartmentCode")]
        public string DepartmentCode
        {
            get
            {
                return this.m_DepartmentCode;
            }
            set
            {
                this.m_DepartmentCode = value;
            }
        }

        [Category("Primary Key"), DisplayName("GroupRateCode")]
        public string GroupRateCode
        {
            get
            {
                return this.m_GroupRateCode;
            }
            set
            {
                this.m_GroupRateCode = value;
            }
        }

        [DisplayName("IsRate"), Category("Column")]
        public bool IsRate
        {
            get
            {
                return this.m_IsRate;
            }
            set
            {
                this.m_IsRate = value;
            }
        }

        public string Product
        {
            get
            {
                return "Class HRM_DEPARTMENT_RATE";
            }
        }
    }
}

